{$MODE FPC}
{$MODESWITCH Result}
{$MODESWITCH Autoderef}
{$MODESWITCH Out}
unit dcreole_multi;

interface

uses
  dcreole;

type
TCreoleMulti = object(TCreoleProcess)
private
  FProcesses: array of PCreoleProcess;
public
  constructor Init;
  procedure AddProcess(Process: PCreoleProcess);

  procedure StartParagraph(C: PCreoleParser); virtual;
  procedure FinishParagraph(C: PCreoleParser); virtual;
  procedure Simple(C: PCreoleParser; P: PAnsiChar; Count: Integer); virtual;
  procedure Unformat(C: PCreoleParser; P: PAnsiChar; Count: Integer); virtual;
  procedure StartNowiki(C: PCreoleParser); virtual;
  procedure FinishNowiki(C: PCreoleParser); virtual;
  procedure EndOfLine(C: PCreoleParser); virtual;
  procedure LineBreak(C: PCreoleParser); virtual;
  procedure StartBold(C: PCreoleParser); virtual;
  procedure FinishBold(C: PCreoleParser); virtual;
  procedure StartItalics(C: PCreoleParser); virtual;
  procedure FinishItalics(C: PCreoleParser); virtual;
  procedure StartBulletList(C: PCreoleParser); virtual;
  procedure StartBulletItem(C: PCreoleParser); virtual;
  procedure FinishBulletItem(C: PCreoleParser); virtual;
  procedure FinishBulletList(C: PCreoleParser); virtual;
  procedure StartNumList(C: PCreoleParser); virtual;
  procedure FinishNumList(C: PCreoleParser); virtual;
  procedure StartNumItem(C: PCreoleParser); virtual;
  procedure FinishNumItem(C: PCreoleParser); virtual;
  procedure Link(C: PCreoleParser; Address, Title: String); virtual;
  procedure StartHeading(C: PCreoleParser; Level: Integer); virtual;
  procedure FinishHeading(C: PCreoleParser; Level: Integer); virtual;
  procedure Horizontal(C: PCreoleParser); virtual;
  procedure Image(C: PCreoleParser; Address, Title: String); virtual;
  procedure StartTable(C: PCreoleParser); virtual;
  procedure FinishTable(C: PCreoleParser); virtual;
  procedure StartRow(C: PCreoleParser); virtual;
  procedure FinishRow(C: PCreoleParser); virtual;
  procedure StartCell(C: PCreoleParser); virtual;
  procedure FinishCell(C: PCreoleParser); virtual;
  procedure StartHeadingCell(C: PCreoleParser); virtual;
  procedure FinishHeadingCell(C: PCreoleParser); virtual;
  procedure Plugin(C: PCreoleParser; P: PAnsiChar; Count: Integer); virtual;
end;

implementation

constructor TCreoleMulti.Init;
begin
  SetLength(FProcesses, 0);
end;

procedure TCreoleMulti.AddProcess(Process: PCreoleProcess);
begin
  SetLength(FProcesses, Length(FProcesses) + 1);
  FProcesses[High(FProcesses)] := Process;
end;

procedure TCreoleMulti.StartParagraph(C: PCreoleParser);
var
  Process: PCreoleProcess;
begin
  for Process in FProcesses do
    Process.StartParagraph(C);
end;

procedure TCreoleMulti.FinishParagraph(C: PCreoleParser);
var
  Process: PCreoleProcess;
begin
  for Process in FProcesses do
    Process.FinishParagraph(C);
end;

procedure TCreoleMulti.Simple(C: PCreoleParser; P: PAnsiChar; Count: Integer);
var
  Process: PCreoleProcess;
begin
  for Process in FProcesses do
    Process.Simple(C, P, Count);
end;

procedure TCreoleMulti.Unformat(C: PCreoleParser; P: PAnsiChar; Count: Integer);
var
  Process: PCreoleProcess;
begin
  for Process in FProcesses do
    Process.Unformat(C, P, Count);
end;

procedure TCreoleMulti.StartNowiki(C: PCreoleParser);
var
  Process: PCreoleProcess;
begin
  for Process in FProcesses do
    Process.StartNowiki(C);
end;

procedure TCreoleMulti.FinishNowiki(C: PCreoleParser);
var
  Process: PCreoleProcess;
begin
  for Process in FProcesses do
    Process.FinishNowiki(C);
end;

procedure TCreoleMulti.EndOfLine(C: PCreoleParser);
var
  Process: PCreoleProcess;
begin
  for Process in FProcesses do
    Process.EndOfLine(C);
end;

procedure TCreoleMulti.LineBreak(C: PCreoleParser);
var
  Process: PCreoleProcess;
begin
  for Process in FProcesses do
    Process.LineBreak(C);
end;

procedure TCreoleMulti.StartBold(C: PCreoleParser);
var
  Process: PCreoleProcess;
begin
  for Process in FProcesses do
    Process.StartBold(C);
end;

procedure TCreoleMulti.FinishBold(C: PCreoleParser);
var
  Process: PCreoleProcess;
begin
  for Process in FProcesses do
    Process.FinishBold(C);
end;

procedure TCreoleMulti.StartItalics(C: PCreoleParser);
var
  Process: PCreoleProcess;
begin
  for Process in FProcesses do
    Process.StartItalics(C);
end;

procedure TCreoleMulti.FinishItalics(C: PCreoleParser);
var
  Process: PCreoleProcess;
begin
  for Process in FProcesses do
    Process.FinishItalics(C);
end;

procedure TCreoleMulti.StartBulletList(C: PCreoleParser);
var
  Process: PCreoleProcess;
begin
  for Process in FProcesses do
    Process.StartBulletList(C);
end;

procedure TCreoleMulti.StartBulletItem(C: PCreoleParser);
var
  Process: PCreoleProcess;
begin
  for Process in FProcesses do
    Process.StartBulletItem(C);
end;

procedure TCreoleMulti.FinishBulletItem(C: PCreoleParser);
var
  Process: PCreoleProcess;
begin
  for Process in FProcesses do
    Process.FinishBulletItem(C);
end;

procedure TCreoleMulti.FinishBulletList(C: PCreoleParser);
var
  Process: PCreoleProcess;
begin
  for Process in FProcesses do
    Process.FinishBulletList(C);
end;

procedure TCreoleMulti.StartNumList(C: PCreoleParser);
var
  Process: PCreoleProcess;
begin
  for Process in FProcesses do
    Process.StartNumList(C);
end;

procedure TCreoleMulti.FinishNumList(C: PCreoleParser);
var
  Process: PCreoleProcess;
begin
  for Process in FProcesses do
    Process.FinishNumList(C);
end;

procedure TCreoleMulti.StartNumItem(C: PCreoleParser);
var
  Process: PCreoleProcess;
begin
  for Process in FProcesses do
    Process.StartNumItem(C);
end;

procedure TCreoleMulti.FinishNumItem(C: PCreoleParser);
var
  Process: PCreoleProcess;
begin
  for Process in FProcesses do
    Process.FinishNumItem(C);
end;

procedure TCreoleMulti.Link(C: PCreoleParser; Address, Title: String);
var
  Process: PCreoleProcess;
begin
  for Process in FProcesses do
    Process.Link(C, Address, Title);
end;

procedure TCreoleMulti.StartHeading(C: PCreoleParser; Level: Integer);
var
  Process: PCreoleProcess;
begin
  for Process in FProcesses do
    Process.StartHeading(C, Level);
end;

procedure TCreoleMulti.FinishHeading(C: PCreoleParser; Level: Integer);
var
  Process: PCreoleProcess;
begin
  for Process in FProcesses do
    Process.FinishHeading(C, Level);
end;

procedure TCreoleMulti.Horizontal(C: PCreoleParser);
var
  Process: PCreoleProcess;
begin
  for Process in FProcesses do
    Process.Horizontal(C);
end;

procedure TCreoleMulti.Image(C: PCreoleParser; Address, Title: String);
var
  Process: PCreoleProcess;
begin
  for Process in FProcesses do
    Process.Image(C, Address, Title);
end;

procedure TCreoleMulti.StartTable(C: PCreoleParser);
var
  Process: PCreoleProcess;
begin
  for Process in FProcesses do
    Process.StartTable(C);
end;

procedure TCreoleMulti.FinishTable(C: PCreoleParser);
var
  Process: PCreoleProcess;
begin
  for Process in FProcesses do
    Process.FinishTable(C);
end;

procedure TCreoleMulti.StartRow(C: PCreoleParser);
var
  Process: PCreoleProcess;
begin
  for Process in FProcesses do
    Process.StartRow(C);
end;

procedure TCreoleMulti.FinishRow(C: PCreoleParser);
var
  Process: PCreoleProcess;
begin
  for Process in FProcesses do
    Process.FinishRow(C);
end;

procedure TCreoleMulti.StartCell(C: PCreoleParser);
var
  Process: PCreoleProcess;
begin
  for Process in FProcesses do
    Process.StartCell(C);
end;

procedure TCreoleMulti.FinishCell(C: PCreoleParser);
var
  Process: PCreoleProcess;
begin
  for Process in FProcesses do
    Process.FinishCell(C);
end;

procedure TCreoleMulti.StartHeadingCell(C: PCreoleParser);
var
  Process: PCreoleProcess;
begin
  for Process in FProcesses do
    Process.StartHeadingCell(C);
end;

procedure TCreoleMulti.FinishHeadingCell(C: PCreoleParser);
var
  Process: PCreoleProcess;
begin
  for Process in FProcesses do
    Process.FinishHeadingCell(C);
end;

procedure TCreoleMulti.Plugin(C: PCreoleParser; P: PAnsiChar; Count: Integer);
var
  Process: PCreoleProcess;
begin
  for Process in FProcesses do
    Process.Plugin(C, P, Count);
end;

end.
